﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Index2.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    按类别进行消费金额统计
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        var id = 'ServiceNo';
        var ctrlName = 'FeeQueryService';
        function Crud2(id, ctrlName) {
            //根据时间查询，查询的结果不分页
            this.Search = function () {
                $('#units').menu('show', {
                    left: 360,
                    top: 75
                });
            };
     
            //打印
            this.Print = function () {
                var form = $('#fm');
                if (!$(form).form('validate')) {
                    return;
                }                                
                var data = $(form).serialize();
                var url = '../' + ctrlName + '/IncomeIndex?' + data;
                ShowDialog(url, 'IncomeIndex', '800px', '600px');
            };
        }
        var crud = new Crud2(id, ctrlName);
        $(function () {
            $('#dg').datagrid({
                title: '消费金额分类查询',
                iconCls: 'icon-save',
                url: '../' + ctrlName + '/List',
                sortName: id,
                sortOrder: 'asc',
                remoteSort: false,
                idField: id,
                frozenColumns: [[
	                { field: 'ck', checkbox: true },
	                { title: '编号', field: id, width: 80, sortable: true },
                    { field: 'DeadNO', title: '死者编号', width: 80 }
				]],
                columns: [[
                        { field: 'DeadName', title: '死者姓名', width: 80 },
                        { field: 'ItemName', title: '服务名称', width: 150 },
                        { field: 'Unit', title: '计量单位', width: 80 },
                        { field: 'Price', title: '价格', width: 80 },
                        { field: 'ServiceCount', title: '数量', width: 80 },
                        { field: 'ServiceFee', title: '费用(元)', width: 100 },
                        { field: 'ApplyTime', title: '申请时间', width: 150,
                            formatter: function (value) {
                                return JsonToDateString(value, 'yyyy-MM-dd hh:mm:ss');
                            }
                        },                        
                        { field: 'PayTime', title: '支付时间', width: 150,
                            formatter: function (value) {
                                return JsonToDateString(value, 'yyyy-MM-dd hh:mm:ss');
                            }
                        },
                        { field: 'Salesman', title: '业务员', width: 100 },
                        { field: 'Cashier', title: '收银员', width: 100 }
                    ]],
                pagination: false,
                fitColumns: true,
                showFooter: true,
                toolbar: '#tb'
            });
        });
        function SeleType(type) {
            var form = $('#fm');
            if (!$(form).form('validate')) {
                return;
            }

            url = '../' + ctrlName + '/Search?type=' + type;
            var data = $(form).serialize();
            $.post(url, data, function (result) {
                if (result.success) {
                    $('#dg').datagrid('loadData', result);        // reload the user data
                } else {
                    $.messager.show({
                        title: '错误',
                        msg: result.msg
                    });
                }
            });
        }               
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="dlg" class="easyui-dialog" closed="true" buttons="#dlg-buttons" style="width: 600px;
        height: 400px; padding: 10px 20px">
        <div class="ftitle">消费收入分类查询</div>
    </div>
   <div id="tb" style="padding:5px;height:auto">   
        <div>
            <form id="fm">
            选择时间:
            <input class="easyui-datebox" id="StartTime" name="StartTime" required="true" style="width:120px"/>至
            <input class="easyui-datebox" id="EndTime" name="EndTime" required="true" style="width:120px"/>
            <%//死者姓名: <input name="DeadName" class="easyui-validatebox" style="width:80px" /> %>
            <a href="#" class="easyui-linkbutton" iconcls="icon-search" onclick="crud.Search()">
                查询</a>
           <a href="#" class="easyui-linkbutton" iconcls="icon-print" onclick="crud.Print()">
                打印</a>
            </form>
        </div>
    </div>
    <div id="units" class="easyui-menu" style="width: 150px;">
        <div iconcls="icon-search" onclick="javascript:SeleType('0200');">
            冷藏消费金额总计</div>
        <div iconcls="icon-search" onclick="javascript:SeleType('0300');">
            整理消费金额总计</div>
        <div class="menu-sep">
        </div>
        <div iconcls="icon-search" onclick="javascript:SeleType('0400');">
            守灵厅消费金额总计</div>
        <div iconcls="icon-search" onclick="javascript:SeleType('0400');">
            告别厅消费金额总计 </div>
        <div iconcls="icon-search" onclick="javascript:SeleType('0600');">
           火化消费金额总计 </div>
        <div iconcls="icon-search" onclick="javascript:SeleType('0800');">
           丧葬用品金额总计</div>
        <div class="menu-sep">
        </div>
        <div iconcls="icon-search" onclick="javascript:SeleType('0000');">
            全部消费金额总计</div>
    </div>
</asp:Content>
